package br.com.gesclub.business.service.core;

import br.com.gesclub.business.dao.GenericDao;
import br.com.gesclub.business.model.BaseEntity;
import br.com.gesclub.business.service.CrudService;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;

@Transactional
public class CrudServiceImpl<T extends BaseEntity, ID extends Serializable>
        implements CrudService<T, ID> {

    protected GenericDao dao;

    @Override
    public ID save(T t) {
        return (ID) dao.save(t);
    }

    public void saveOrUpdate(T t) {
        dao.saveOrUpdate(t);
    }


    // Sets para o spring
    public void setDao(GenericDao dao) {
        this.dao = dao;
    }

}
